import {
  Button,
  Dialog,
  DialogActions,
  DialogContent,
  DialogContentText,
  DialogTitle,
} from "@mui/material";
import React from "react";
import "./confirm.less";

interface IConfirmProps {
  isShow: boolean;
  message: string;
  onClose: () => void; // 这是我们写一个函数的约束格式
  onSure: () => void;
}

export default function Confirm({
  isShow,
  message,
  onClose,
  onSure,
}: IConfirmProps) {
  return (
    <Dialog
      open={isShow}
      aria-labelledby="alert-dialog-title"
      aria-describedby="alert-dialog-description"
    >
      <DialogTitle id="alert-dialog-title">警告</DialogTitle>
      <DialogContent>
        <DialogContentText id="alert-dialog-description">
          {/* 这部分的内容也是会变的，也是需要放到redux里面的 */}
          {/* 这里不带大家做，大家自己模仿之前写toast实现 */}
          是否切换{message}作为默认学科
        </DialogContentText>
      </DialogContent>
      <DialogActions>
        <Button onClick={() => onClose()}>取消</Button>
        <Button autoFocus onClick={() => onSure()}>
          确定
        </Button>
      </DialogActions>
    </Dialog>
  );
}
